package com.nf.health.app.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.nf.health.app.R;
import com.nf.health.app.models.Praise;

import java.util.List;

public class PraiseAdapter extends BaseAdapter {


	private Context context;
	private List<Praise> praises;
	public PraiseAdapter(Context context, List<Praise> praises) {
		this.context = context;
		this.praises = praises;
	}
	@Override
	public int getCount() {
		if(praises!=null){
			return praises.size();
		}
		return 0;
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = ViewHolder.get(parent, convertView, R.layout.item_praise, position);
		Praise praise = praises.get(position);
		holder.setText(R.id.doctor_name, praise.getDoctorname());
		holder.setText(R.id.tv_pay_type, praise.getAccept_desc());
		holder.setText(R.id.doctor_type, praise.getHospital());
		holder.setText(R.id.tv_price, praise.getPrice());
		holder.setText(R.id.tv_project_name, praise.getRisk_evaluation());
		holder.setText(R.id.tv_count, praise.getOrdernum());
		holder.setText(R.id.tv_order_num, praise.getOrderno());
		holder.setText(R.id.tv_time, praise.getUpdate_time());
		TextView tv_pay = holder.getView(R.id.tv_pay);
		int state = Integer.parseInt(praise.getIs_accept());
		switch (state) {
		case Praise.STATE_NO_RECEIVE:
			//可删除
			break;
		case Praise.STATE_RECEIVE:
			
			break;
		case Praise.STATE_FINISH:
			
			break;
		case Praise.STATE_GIVE_UP:
			
			break;
		case Praise.STATE_NO_PAY:
			//TODO  显示支付按钮，可删除
			tv_pay.setVisibility(View.VISIBLE);
			break;
		case Praise.STATE_REFUND:
			//可删除
			break;

		default:
			break;
		}
		return holder.getConvertView();
	}
}
